// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App'
import router from './router'
import store from './store'
import './css/main.scss'
// import axios from '@/config/http'
import config from './config/index.js'
import './config/api.js'

import './plugins/chart.js'
// 国际化插件
// import utils from '@/config/cookieUtils'
import {formatNum} from '@/utils/formatNum.js'
import {getArrListByname} from '@/utils/getArrListByname.js'
import {reformNumber} from '@/utils/reformNumber.js'
import VueI18n from 'vue-i18n'

import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locale from 'element-ui/lib/locale'
Vue.use(VueI18n) // 通过插件的形式挂载

// Vue.prototype.$axios = axios
Vue.prototype.$formatNum = formatNum
Vue.prototype.$getArrListByname = getArrListByname
Vue.prototype.$reformNumber = reformNumber
Vue.use(ElementUI)
Vue.config.productionTip = false
// Vue.prototype.axios = axios

// let currentLang = utils.get('currentViewLang')
// if (currentLang !== 'en-US') {
//   currentLang = 'zh-CN'
// }

// if (currentLang === 'en-US') {
//   import('./css/en.css')
//   Vue.use(ElementUI, {enLocale})
//   locale.use(enLocale)
// } else {
Vue.use(ElementUI, {zhLocale})
locale.use(zhLocale)
// }

const i18n = new VueI18n({
  locale: config.locale,
  messages: {
    'zh-CN': require('./lang/zh'),
    'en-US': require('./lang/en')
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  // axios,
  i18n,
  render: h => h(App)
  // components: { App },
  // template: '<App/>'
})
